package com.binguo.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 */

@Getter
@AllArgsConstructor
public enum PayType {

    QRCODEPAY(0, "二维码支付"),
    FACEPAY(1, "人脸支付"),
    CARDPAY(2, "实体卡支付"),
    OTHERPAY(3, "其他支付"),
    MICROPAY(4, "扫码支付"),
    WXMICROPAY(5,"微信扫码支付"),
    ALIMICROPAY(6,"支付宝扫码支付"),
    CUSTOMERMESHPAY(7, "小程序订单会员支付"),
    OTHERPAY_ALI(8,"线下支付宝支付"),
    OTHERPAY_WX(9,"线下微信支付"),
    COUPON(10,"优惠券支付");

    private Integer code;
    private String name;

    private static final Map<Integer,PayType> VALUE_MAP = new HashMap<Integer,PayType>(16);

    public static PayType getEnumByCode(Integer code){
        if(VALUE_MAP.isEmpty()){
            for (PayType value : PayType.values()) {
                VALUE_MAP.put(value.code,value);
            }
        }
        return VALUE_MAP.get(code);
    }
}
